package com.example.dbmysql.mapper;

import com.example.dbmysql.pojo.User;
import org.apache.ibatis.annotations.*;

@Mapper
public interface UserMapper {

    @Select("select * FROM user where username=#{username}")
    User findByUserName(String username);

    @Insert("insert into user(username,password,create_timer,update_timer)"+
    "values(#{username},#{md5String},now(),now())")
    void add(String username, String md5String);

    @Update("update user set nickname=#{nickname},update_timer=#{updateTimer} where id=#{id}")
    void update(User user);

    @Delete("DELETE FROM user where id=#{id} AND username=#{username} ")
    void DelUser(User user);
}
